package top.hkyzf.study.leetcode.string;

import org.junit.Test;

/**
 * @author 朱峰
 * @date 2022-1-22 15:29
 */
public class 删除回文子序列_1332 {
    public int removePalindromeSub(String s) {
        int left = 0;
        int right = s.length()-1;
        while (left < right) {
            if (s.charAt(left) == s.charAt(right)) {
                left++;
                right--;
            } else {
                return 2;
            }
        }
        return 1;
    }

    @Test
    public void testRemovePalindromeSub () {
        String s = "bab";
        System.out.println(removePalindromeSub(s));
    }
}
